package cn.htcode.service.imp;

import cn.htcode.domain.User;
import cn.htcode.mapper.UserMapper;
import cn.htcode.service.ILoginService;
import cn.htcode.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;

/**
 * @author: Mr_he
 * @Version:1.0
 */
public class LoginImpl implements ILoginService {


    @Override
    public User login(String account, String password) {
        try (SqlSession sqlSession = MybatisUtil.getSqlSession()) {
            UserMapper mapper = sqlSession.getMapper(UserMapper.class);
            User user = mapper.login(account, password);
            return user;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
